package com.alibaba.citrus.cr.unified.inventory.sdo;

import com.alibaba.citrus.cr.unified.inventory.dto.api.request.InvoiceOrderDetailCreateDTO;
import lombok.Data;
import org.apache.commons.collections.MapUtils;

import java.util.List;
import java.util.Map;

@Data
public class InvoiceOrderSDO {

    /**
     * id
     */
    private Long id;

    /**
     * SAP发票号
     */
    private String invoiceOrderId;

    /**
     * 被冲销发票号
     */
    private String reverseInvoiceId;

    /**
     * 类型
     */
    private Integer type;

    /**
     * 销售组织
     */
    private String saleOrganizationCode;

    /**
     * 交货单号
     */
    private String deliveryOrderId;

    /**
     * 订单号
     */
    private String sourceOrderId;

    /**
     * 出具发票日期
     */
    private String sapGenerateTime;

    /**
     * 创建人
     */
    private String creator;

    /**
     * 创建日期
     */
    private String createDate;

    /**
     * 售达方编码
     */
    private String companyCode;

    /**
     * 发票明细
     */
    private List<InvoiceOrderDetailSDO> detailList;

    /**
     * 扩展字段
     */
    private Map<String, String> feature;

    public String getFeatureStr() {
        StringBuilder sb = new StringBuilder();
        if (MapUtils.isEmpty(feature)) {
            return sb.toString();
        }
        for (Map.Entry<String, String> entry : feature.entrySet()) {
            sb.append(entry.getKey()).append(":").append(entry.getValue());
        }
        return sb.toString();
    }
}
